<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>    
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>商城产品列表</title>
    <%@include file="../common/header.jsp" %>
      <script type="text/javascript">
    </script>
</head>
<body>

<%@include file="../common/top.jsp" %>
<form action="${pathUrl }/home/goods/index" id="priceForm" method="post">
<div class="section">
    <div class="screen-box">
        <!--分类-->
        <dl>
            <dt>分类：</dt>
            <dd class="catalog">
                <a href="javascript:;" data-id="-1" <c:if test="${goodsTools.catalog == -1}">class="selected"</c:if>  >全部</a>
            <c:forEach items="${goodsCatalogList}" var="gc">
            <a href="javascript:;" <c:if test="${goodsTools.catalog == gc.id}">class="selected"</c:if> data-id="${gc.id}">${gc.name}</a>
            </c:forEach>
            </dd>
        </dl>
        <!--/分类-->
        <!--价格-->
        <dl>
            <dt>价格：</dt>
            <dd class="priceDD">
                <a href="javascript:;" data-id="-1" <c:if test="${goodsTools.priceD == -1}">class="selected"</c:if>  >全部</a>
                <a href="javascript:;" data-id="0" <c:if test="${goodsTools.priceD == 0}">class="selected"</c:if>>0-100元</a>
                <a href="javascript:;" data-id="1" <c:if test="${goodsTools.priceD == 1}">class="selected"</c:if>>101-500元</a>
                <a href="javascript:;" data-id="2" <c:if test="${goodsTools.priceD == 2}">class="selected"</c:if>>501-1000元</a>
                <a href="javascript:;" data-id="3" <c:if test="${goodsTools.priceD == 3}">class="selected"</c:if>>1001-2000元</a>
                <a href="javascript:;" data-id="4" <c:if test="${goodsTools.priceD == 4}">class="selected"</c:if>>2000以上</a>
            </dd>
        </dl>
        <!--/价格-->
    </div>

    <div class="sort-box">
        <a href="javascript:;" data-id="0" <c:if test="${goodsTools.sort==0}">class="selected"</c:if>  >上架时间</a>
        <a href="javascript:;"  data-id="1" <c:if test="${goodsTools.sort==1}">class="selected"</c:if> >按人气</a>
        <a href="javascript:;"  data-id="2" <c:if test="${goodsTools.sort==2}">class="selected"</c:if> >价格从高到低</a>
        <a href="javascript:;"  data-id="3" <c:if test="${goodsTools.sort==3}">class="selected"</c:if> >价格从低到高</a>
        </div>
    <div id="loadDiv">

            <ul class="img-list">
                <c:forEach var="temp" items="${goodsIPage.records}">
                    <li>
                        <a href="${pathUrl}/home/goods/detail?id=${temp.id}" target="_blank">
                            <div class="img-box">
                                <img onerror="this.src='${pathUrl}/public/images/nopic.png'" src="${pathUrl}${temp.goodsImg}">
                            </div>
                            <div class="info">
                                <h3>${temp.goodsName}</h3>
                                <p class="price"><b>${temp.sellPrice}</b>元</p>
                                <p>
                                    <strong>${temp.goodsNumber}</strong>
                                    <span>市场价：<s>${temp.marketPrice}</s></span>
                                </p>
                            </div>
                        </a>
                    </li>
                </c:forEach>


            </ul>

        </div>

    <div id="pagerDiv" style="margin-top: 5px;clear:both;">
        <div style="float: left;">共${goodsIPage.total}条记录,当前显示第${goodsIPage.current}页,每页${goodsIPage.size}条</div>
        <div style="float: right;" name="laypage1.3" class="laypage_main laypageskin_molv" id="laypage_0"><a href="${pathUrl}/home/goods/index?current=1&name=${goodsTools.name}&catalog=${goodsTools.catalog}&priceD=${goodsTools.priceD}&sort=${goodsTools.sort}">首页</a><a href="${pathUrl}/home/goods/index?current=${goodsIPage.current==1?1:goodsIPage.current-1}&name=${goodsTools.name}&catalog=${goodsTools.catalog}&priceD=${goodsTools.priceD}&sort=${goodsTools.sort}">上一页</a>&nbsp;&nbsp; ${goodsIPage.current}/${pages} &nbsp;&nbsp;<a href="${pathUrl}/home/goods/index?current=${goodsIPage.current==pages?pages:goodsIPage.current+1}&name=${goodsTools.name}&catalog=${goodsTools.catalog}&priceD=${goodsTools.priceD}&sort=${goodsTools.sort}">下一页</a> <a href="${pathUrl}/home/goods/index?current=${pages}&name=${goodsTools.name}&catalog=${goodsTools.catalog}&priceD=${goodsTools.priceD}&sort=${goodsTools.sort}">尾页</a></div>
    </div>

</div>
<input type="hidden" value="${goodsTools.catalog}" name="catalog" id="catalogId"  >
<input type="hidden" value="${goodsTools.priceD}" name="priceD" id="priceType">
<input type="hidden" value="${goodsTools.sort}" name="sort" id="orderType" >
</form>

<div class="section qitian-main">
    <img src="${pathUrl}/public/images/qitian.png">
</div>
<div class="footer-copyright">
    <p>软信商城©2013-2017 软信大学版权所有 京ICP备17017089号 京公网安备11000002000006号</p>
</div>
<jsp:include page="../../common/laypage.jsp"/>
<script type="text/javascript">
$(function(){
	$(".catalog a").click(function(){

		var catalogId=$(this).attr("data-id");
		$(this).addClass("selected");
		$(this).siblings().removeClass("selected");
		$("#catalogId").val(catalogId);
        $("#priceForm").submit();

	});
	$(".priceDD a").click(function(){
		var priceType=$(this).attr("data-id");
		$(this).addClass("selected");
		$(this).siblings().removeClass("selected");
		$("#priceType").val(priceType);
        $("#priceForm").submit();
	});
	$(".sort-box a").click(function(){
		var orderType=$(this).attr("data-id");
		$(this).addClass("selected");
		$(this).siblings().removeClass("selected");
		$("#orderType").val(orderType);
        $("#priceForm").submit();
	});
});


</script>
</body>
</html>